﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Optparse;
using Optparse.Options;

namespace Optparse.Console {
    class Program {
        static void Main(string[] args) {
            OptionParser parser = new OptionParser("%title -- %description\n%copyright\n%product(%version)\nUsage:console.exe [OPTIONS]", "1.3.3");
            parser.AddOption(new StringArgOption("-f", "--file", "FILENAME", "Type a file name, use to read data to buffer."));
            parser.AddOption(new IPAddressArgOption("-i", "--ip", "IP", "Type ip address, if null 127.0.0.1 will be used.", "127.0.0.1"));
            parser.AddOption(new IntArgOption("-p", "--port", "PORT", "Type a port for socket listened, if null 21121 will be used.", 21121));

            //OptionGroup group = new OptionGroup("Debug mode");
            //group.AddOption(new BoolArgOption("-d", "--debug", string.Empty, "Indicate the debug mode is enabled. if true, enabled.", true));
            //group.AddOption(new BoolArgOption("-P", "--print", string.Empty, "", false));
            //parser.AddOptionGroup(group);

            parser.PrintUsage();

            parser.Parse();

            System.Console.WriteLine("\n============================================\n");
            System.Console.WriteLine("{0,-6} : {1}", "-f", parser.GetValue("-f"));
            System.Console.WriteLine("{0,-6} : {1}", "-i", parser.GetValue("-i"));
            System.Console.WriteLine("{0,-6} : {1}", "-p", parser.GetValue("-p"));
            //System.Console.WriteLine("{0,-6} : {1}", "-d", parser.GetValue("-d"));
            //System.Console.WriteLine("{0,-6} : {1}", "-P", parser.GetValue("-P"));
            //System.Console.WriteLine("{0,-6} : {1}", "-f", parser.GetValue("-f"));

            System.Console.Read();
        }
    }
}
